unit uScenes;

interface

uses Classes, uScene;

type
  TScenes = class(TScene)
  private
    FScene: TScene;
    procedure SetScene(const Value: TScene);
  public
    procedure Timer; override;
    procedure MouseUp(Button: TMouseBtn); override;
    procedure MouseDn(Button: TMouseBtn); override;
    procedure Render; override;
    procedure KeyDown(var Key: Word); override;
    procedure MouseMove(X, Y: Integer); override;
    property Scene: TScene read FScene write SetScene default nil;
    procedure Clear;
  end;

var
  Scenes: TScenes;

implementation

{ TScenes }

procedure TScenes.Clear;
begin
  Scene := nil;
end;

procedure TScenes.MouseUp(Button: TMouseBtn);
begin
  if (Scene <> nil) then Scene.MouseUp(Button);
end;

procedure TScenes.KeyDown(var Key: Word);
begin
  if (Scene <> nil) then Scene.KeyDown(Key);
end;

procedure TScenes.MouseMove(X, Y: Integer);
begin
  if (Scene <> nil) then Scene.MouseMove(X, Y);
end;

procedure TScenes.Render;
begin
  if (Scene <> nil) then Scene.Render;
end;

procedure TScenes.SetScene(const Value: TScene);
begin
  FScene := Value;
  Render;
end;

procedure TScenes.Timer;
begin
  if (Scene <> nil) then Scene.Timer;
end;

procedure TScenes.MouseDn(Button: TMouseBtn);
begin
  if (Scene <> nil) then Scene.MouseDn(Button);
end;

initialization
  Scenes := TScenes.Create;  

finalization
  Scenes.Free;

end.
